package com.example.figurehecheng.controller.merchant;

import com.example.figurehecheng.common.result.Result;
import com.example.figurehecheng.domain.vo.TurnoverReportVO;
import com.example.figurehecheng.domain.vo.TurnoverVO;
import com.example.figurehecheng.service.IOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 宇科工作室
 * @since 2024-10-18
 */
@RestController("merchantWorkSpaceController")
@RequestMapping("/merchant/WorkSpace")
@CrossOrigin
@RequiredArgsConstructor
@Api(tags = "工作台")
@Slf4j
public class WorkSpaceController {

    private final IOrderService orderService;


    /**
     * 获取今天，这周，这个月，今年收入总金额
     * @return
     */
    @GetMapping("/getTurnover")
    @ApiOperation("获取今天，这周，这个月，今年收入总金额")
    public Result<TurnoverVO> getTurnover(){
        log.info("获取今天，这周，这个月，今年收入总金额");
        TurnoverVO turnoverVO = orderService.getTurnover();
        return Result.success(turnoverVO);
    }


    /**
     * 营业额统计
     * @param
     * @param
     * @return
     */
    @GetMapping("/turnoverStatistics")
    @ApiOperation("营业额统计")
    public Result<List> turnoverStatistics(){
        log.info("营业额数据统计");
        return Result.success(orderService.getTurnoverStatistics());
    }

}
